var SdsOPQcincaseOperLog = {
    
};

$(function () {
    //日志dialog
    var html='<div id="winOperLog">'
    html+='<div id="gridOperLog"></div>'
    html+='</div>'
    html+='</div>'
    $("body").append(html);
    $.parser.parse('#winOperLog');
    //初始操作日志窗口
    $('#winOperLog').dialog({
        title:"操作日志",
        closed: true,
        iconCls:'icon-w-save',
        modal: true,
        center:true,
        width:'800',
        height:document.documentElement.clientHeight-100,
    });
})

SdsOPQcincaseOperLog.ShowLog=function(mrlistID){
    $HUI.datagrid("#gridOperLog",{
        fit:true,
        url:'/sds/sdsopqcincase/selectOperLogByIncaseId?incaseId='+mrlistID,
        method : "get",
        singleSelect: false,
        //定义是否设置基于该行内容的行高度。设置为 false，则可以提高加载性能
        autoRowHeight: false,
        striped:true,
        rownumbers:true,
        loadMsg:'数据加载中...',
        idField:"rowId",
        /*queryParams:{
            ClassName:"DHCMA.CPW.SDS.QCMrListStateSrv",
            QueryName:"QryOperLog",
            aMrlistID:mrlistID,
            rows:10000
        },*/
        columns:[[
            {field:'operState',title:'操作状态',width:'100',align:'left',sortable:true},
            {field:'operUser',title:'操作人',width:'100',align:'left',sortable:true},
            {field:'operDate',title:'操作日期',width:'120',align:'left',sortable:true,
                formatter: function(value,row,index){
                    let appointDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(value)[0];
                    return appointDate;
                }
            },
            {field:'operDate',title:'操作时间',width:'120',align:'left',sortable:true,
                formatter: function(value,row,index){
                    let appointDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(value)[1];
                    return appointDate;
                }
            },
            {field:'operResume',title:'操作备注',width:'250',align:'left',sortable:false},
        ]]/*,
        view: detailview,
        detailFormatter: function(rowIndex, rowData){
            var tails = "test1#test2"
            var DetailsArr=tails.split('#')
            var html='<table style="width:100%;">'
            html+='<tr>'
            html+='<th>项目</th>'
            html+='<th>变更前</th>'
            html+='<th>变更后</th>'
            html+='</tr>'
            for (var ind=0;ind<DetailsArr.length;ind++) {

                var DetailStr=DetailsArr[ind]
                if(DetailStr=='') continue;
                html+='<tr>'
                var ItemDesc=DetailStr.split('^')[0]
                var PreVal=DetailStr.split('^')[1]
                var NewVal=DetailStr.split('^')[2]
                html+='<td style="width:40%;">'+ItemDesc+'</td>'
                html+='<td style="width:25%;">'+PreVal+'</td>'
                html+='<td style="width:25%;">'+NewVal+'</td>'
                html+='</tr>'
            }
            html+='</table>'
            return html;
        }
        ,onLoadSuccess: function(data){
            for (var index=0;index<data.rows.length;index++) {
                if (data.rows[index].Details=="") {
                    $(this).datagrid('getExpander', index).hide();
                }
            }
        }*/
    });

    $HUI.dialog('#winOperLog').open()
}
